cmake_minimum_required(VERSION 3.5)

project(ACL_YOLOV3)

#if you use x86 host,disable compiler option
#SET(CMAKE_C_COMPILER "aarch64-linux-gnu-gcc-5")
#SET(CMAKE_CXX_COMPILER "aarch64-linux-gnu-g++-5")

add_definitions(-std=c++11)
add_definitions(-fPIC)
set(CMAKE_SKIP_BUILD_RPATH TRUE)
SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR})

# OpenCV_DIR目录包含OpenCVConfig.cmake
set(OpenCV_DIR /home/ma-user/work/opencv-4.5.1/lib/cmake/opencv4)
# 找到opencv库
find_package(OpenCV REQUIRED)

# If the package has been found, several variables will
# be set, you can find the full list with descriptions
# in the OpenCVConfig.cmake file.
# Print some message showing some of them
if(${OPENCV_FOUND})
    message(STATUS "OpenCV version: ${OpenCV_VERSION}")
    message(STATUS "OpenCV include path: ${OpenCV_INCLUDE_DIRS}")
    message(STATUS "OpenCV libraries: ${OpenCV_LIBS}")
endif()

# Add OpenCV headers location to your include paths
include_directories(${OpenCV_INCLUDE_DIRS})

set(ACL_PATH /home/ma-user/Ascend/ascend-toolkit/latest)
INCLUDE_DIRECTORIES(
    ${ACL_PATH}/acllib/include
    ${OpenCV_INCLUDE_DIRS}
    AclProcess
    )

set(ACL_LIB_PATH ${ACL_PATH}/acllib/lib64/stub)
link_directories(${ACL_LIB_PATH})

add_executable(${PROJECT_NAME}
    main.cpp
    AclProcess/AclProcess.cpp
    AclProcess/ModelProcess.cpp
    )

target_link_libraries(${PROJECT_NAME} ascendcl ${OpenCV_LIBS} pthread -Wl,-z,relro,-z,now,-z,noexecstack -pie -s stdc++ dl)
